/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.hshn.mi.ajax;

import java.util.Map;
import java.util.TreeMap;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author Administrator
 */
@ManagedBean(name = "switcher")
@RequestScoped
public class ThemeSwitcherBean{

    private Map<String, String> themes;
    private static String theme = "cupertino";
    private String selectedTheme = "cupertino";

    public ThemeSwitcherBean() {
        themes = new TreeMap<String, String>();
        this.init();
    }

    /**
     *  Sets the given theme-name as the selected theme.
     */
    public void setSelectedTheme(String theme) {
        this.selectedTheme = theme;
    }

    /**
     * Returns the selected theme.
     */
    public String getSelectedTheme() {
        return selectedTheme;
    }

    /**
     * Returns a map with all possible themes.
     */
    public Map<String, String> getThemes() {
        return themes;
    }

    /**
     * Returns a theme.
     */
    public String getTheme() {
        return theme;
    }

    /**
     * Sets the given theme as the current theme.
     * @param theme
     */
    public void setTheme(String theme) {
        ThemeSwitcherBean.theme = theme;
    }

    /*
     * Sets the selected theme to the current used theme.
     */
    public void setSelectedTheme() {
        theme = selectedTheme;
    }

    /**
     * Existting themes are initialized.
     */
    public void init() {
        themes = new TreeMap<String, String>();
        themes.put("Black-Tie", "black-tie");
        themes.put("Blitzer", "blitzer");
        themes.put("Bluesky", "bluesky");
        themes.put("Cupertino", "cupertino");
        themes.put("Dark-Hive", "dark-hive");
        themes.put("Flick", "flick");
        themes.put("Midnight", "midnight");
        themes.put("Redmond", "redmond");
        themes.put("Sam", "sam");
        themes.put("Start", "start");
        themes.put("UI-Darkness", "ui-darkness");
    }
}

